<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">

    <h:form id="formLisEixo" prependId="false">
        <p:panel id="pnlForm" header="Lista de Pacientes" style="width: 100%">


            <h:panelGrid  width="100%">
                <h:panelGrid columns="2" >
                    <h:panelGrid columns="2" >

                        <p:outputLabel value="Nome:"/>
                        <h:inputText value="#{pacienteMb.nome}"/>

                        <p:outputLabel value="CPF:"/>
                        <h:inputText value="#{pacienteMb.cpf}"/>

                        <p:outputLabel value="Código:"/>
                        <h:inputText value="#{pacienteMb.cod}"/>
                    </h:panelGrid>

                </h:panelGrid>
                <h:panelGrid columns="2" style="float: right" >
                    <p:commandButton value="Pesquisar" action="#{pacienteMb.pesquisar()}" update="tblLisRaca" />
                    <p:commandButton value="Novo" action="#{ultilMb.navCadRaca()}"  />
                </h:panelGrid>
                <p:dataTable id="tblLisRaca" paginator="true" rows="10"  emptyMessage="Raças não encontradas" var="item" value="#{pacienteMb.pacientes}"
                             rowStyleClass="#{empty rowIx or rowIx mod 2 ne 0 ? 'even-row' : 'odd-row'}" rowIndexVar="rowIx">
                    <p:column>
                        <f:facet name="header">
                            Id
                        </f:facet>
                        <h:outputText value="#{item.id}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            Descrição
                        </f:facet>
                        <h:outputText value="#{item.pessoa.nome}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            Descrição
                        </f:facet>
                        <h:outputText value="#{item.pessoa.telefone}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            Ações
                        </f:facet>
                        <p:commandButton  id="btnEdit" icon="ui-icon-pencil" update="tblLisRaca" action="#{ultilMb.navEditRaca()}"
                                          title="Editar"  >
                            <f:setPropertyActionListener target="#{pacienteMb.p3}" value="#{item}"/>
                            <f:setPropertyActionListener target="#{pacienteMb.pessoa5}" value="#{item.pessoa}"/>
                            <f:setPropertyActionListener target="#{pacienteMb.cidade}" value="#{item.pessoa.endereco.cidade}"/>
                            <f:setPropertyActionListener target="#{pacienteMb.endereco}" value="#{item.pessoa.endereco}"/>
                        </p:commandButton>
                        <p:commandButton  id="btnDel" icon="ui-icon-trash" update="tblLisRaca" onclick="confirmationDelEixo.show()"
                                          title="Remover"  >
                            <f:setPropertyActionListener target="#{pacienteMb.p3}" value="#{item}"/>
                        </p:commandButton>
                    </p:column>

                </p:dataTable>
            </h:panelGrid>

        </p:panel>
    </h:form>
</ui:composition>
